﻿using LitJson;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class SingleBranchSerializor : LeafSerializor
{
    public override INodeData DeSerializeData(string json)
    {
        INodeData node = new SingleBranchNodeData();
        JsonData data = JsonMapper.ToObject(json);
        NodeDataDeSerialize(data, ref node);
        JsonData temp = data["ChildNode"];
        var Serializor = BehaviorSystem.NodeDataSerilizors[temp["NodeType"].AsInt];
        NodeData nodeData = (NodeData)Serializor.DeSerializeData(temp.ToJson());
        ((SingleBranchNodeData)node).ChildNode = nodeData;
        return node;
    }
}